<!DOCTYPE html>
<html lang="en">
<head>
        <title>Virtual</title>
        <meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <link rel="shortcut icon" href="../theme/images/favicon.ico"/>
        <link rel="stylesheet" href="../theme/css/main.css" type="text/css" />
        <link href="www.j-marjanovic.io/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="j-marjanovic.io Atom Feed" />

        <!--[if IE]>
                <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->

        <!--[if lte IE 7]>
                <link rel="stylesheet" type="text/css" media="all" href="../css/ie.css"/>
                <script src="../js/IE8.js" type="text/javascript"></script><![endif]-->

        <!--[if lt IE 7]>
                <link rel="stylesheet" type="text/css" media="all" href="../css/ie6.css"/><![endif]-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="theme/jquery.cookiesdirective.js"></script>

</head>

<body id="index" class="home">
<script type="text/javascript">
	// Using $(document).ready never hurts
	$(document).ready(function(){

		// Cookie setting script wrapper
		var cookieScripts = function () {
			// Internal javascript called
			console.log("Running");
		
			// Loading external javascript file
			$.cookiesDirective.loadScript({
				uri:'external.js',
				appendTo: 'eantics'
			});
		}
	
		/* Call cookiesDirective, overriding any default params
		
			*** These are the defaults ***
				explicitConsent: true,
				position: 'top',
				duration: 10,
				limit: 0,
				message: null,				
				cookieScripts: null,
				privacyPolicyUri: 'privacy.html',
				scriptWrapper: function(){},	
				fontFamily: 'helvetica',
				fontColor: '#FFFFFF',
				fontSize: '13px',
				backgroundColor: '#000000',
				backgroundOpacity: '80',
				linkColor: '#CA0000'
				
		*/
		
		$.cookiesDirective({
			privacyPolicyUri: 'myprivacypolicy.html',
			explicitConsent: false,
			position : 'bottom',
			scriptWrapper: cookieScripts, 
			cookieScripts: 'Google Analytics', 
			backgroundColor: '#52B54A',
			linkColor: '#ffffff'
		});
	});
</script>

	
  <!-- <header id="banner" class="body"> -->
  <!--               <h1><a href="../"><img src="http://www.launchyard.com/images/logo.png" /></a></h1> -->
  <!--       </header> --> 

  <div class="LaunchyardDetail" style="align:right;">
    <!-- <p> -->
    <!-- <img src="../theme/images/blue-pin.png" width="100" height="100" alt="Graph icon"> -->
    <!-- </p> -->
    <p><a id="sitesubtitle" href="../">j-marjanovic.io</a></p>

	<br>
    <p style="float: right; margin-right: 50px;"><a id="aboutlink" href="../pages/about.html">About</a></p>

    <br>
	<p style="float: right; margin-right: 50px;"><img src="../theme/images/icons/rss.png"> <a id="aboutlink" href="../feeds/jan-marjanovic.atom.xml">Atom feed</a></p>
    <br>

  </div>

<section id="content" >
    <div class="body">
      <article>
        <header>
          <h1 class="entry-title">
            <a href="../drafts/virtual.html" rel="bookmark"
               title="Permalink to Virtual">Virtual</a></h1>

        </header>

        <div class="entry-content">
<div class="post-info">
	<ul>
        <li class="vcard author">
                 by&nbsp;<a class="url fn" href="../author/jan-marjanovic.html">Jan Marjanovic</a>
        </li>
        <li class="published" title="2015-04-20T19:00:00+02:00">
          on&nbsp;Mon 20 April 2015
        </li>

	</ul>
<p>Category: <a href="../tag/qemu.html">QEMU</a>, <a href="../tag/emulator.html">Emulator</a>, <a href="../tag/x86.html">x86</a>, </p>
</div><!-- /.post-info -->          <h2>Motivation</h2>
<p>Why would anybody want to emulate a PCI express card in in an x86 emulator? Well,
there may be severl reasons for doing this. In my case, I want to see how 
(poorely documented) driver communicates with PCI express card. Another reason may
be to inpect how the closed source drivers work, but this may in some cases be
agains EULA. A third reasons which comes to my mind would be to simulate the system
with x86 (or some other arch) processor communicating with custom hardware. 
SystemVerilog (a languge to describe hardware) support the inclusion of functions,
written in C (this is called DPI). ALthough this will work, at least in my enviornment
would be easier and faster to buy a FPGA PCIe card and evalute the system in real world.</p>
<p>jan@jan-VirtualBox:~/QEMU/QEMU-src/qemu/bin/debug/native$ x86_64-softmmu/qemu-system-x86_64 -hda ../../../../../ubuntu.img -m 1024 -enable-kvm -device pci-mydev 
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory</p>
<p>sudo apt-get install qemu-kvm</p>
<p>git://git.kiszka.org/kvm-kmod.git</p>
<p>Včeraj sem ostal:</p>
<p>jan@jan-VirtualBox:~/QEMU/QEMU-src/kvm-kmod<span class="math">\( less README 
jan@jan-VirtualBox:~/QEMU/QEMU-src/kvm-kmod\)</span> git submodule init
Submodule 'linux' (http://git.kernel.org/pub/scm/virt/kvm/kvm.git) registered for path 'linux'
jan@jan-VirtualBox:~/QEMU/QEMU-src/kvm-kmod<span class="math">\( git submodule update
Cloning into 'linux'...
remote: Counting objects: 4138844, done.
remote: Compressing objects: 100% (767505/767505), done.
^Cceiving objects:   0% (15540/4138844), 6.88 MiB | 29.00 KiB/s
jan@jan-VirtualBox:~/QEMU/QEMU-src/kvm-kmod\)</span> </p>
<p>jan@jan-VirtualBox:~/QEMU/QEMU-src/kvm-kmod$ lsmod
Module                  Size  Used by
kvm                   452043  0 </p>
<p>Module opritons (Property)</p>
<p>http://lxr.free-electrons.com</p>
<p>% ./x86_64-softmmu/qemu-system-x86_64 -hda ../../../../../images/ubuntu.img -m 1024 --enable-kvm -vga vmware -device pci-mydev,dev=0x1235</p>
<p>% ./x86_64-softmmu/qemu-system-x86_64 -hda ../../../../../images/ubuntu.img -m 2048 --enable-kvm -vga vmware -smp 2 -device pci-mydev,bar=0:0x1000-2:0x100</p>
<script type="text/javascript">if (!document.getElementById('mathjaxscript_pelican_#%@#$@#')) {
    var align = "center",
        indent = "0em",
        linebreak = "false";

    if (false) {
        align = (screen.width < 768) ? "left" : align;
        indent = (screen.width < 768) ? "0em" : indent;
        linebreak = (screen.width < 768) ? 'true' : linebreak;
    }

    var mathjaxscript = document.createElement('script');
    mathjaxscript.id = 'mathjaxscript_pelican_#%@#$@#';
    mathjaxscript.type = 'text/javascript';
    mathjaxscript.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/latest.js?config=TeX-AMS-MML_HTMLorMML';

    var configscript = document.createElement('script');
    configscript.type = 'text/x-mathjax-config';
    configscript[(window.opera ? "innerHTML" : "text")] =
        "MathJax.Hub.Config({" +
        "    config: ['MMLorHTML.js']," +
        "    TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'none' } }," +
        "    jax: ['input/TeX','input/MathML','output/HTML-CSS']," +
        "    extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']," +
        "    displayAlign: '"+ align +"'," +
        "    displayIndent: '"+ indent +"'," +
        "    showMathMenu: true," +
        "    messageStyle: 'normal'," +
        "    tex2jax: { " +
        "        inlineMath: [ ['\\\\(','\\\\)'] ], " +
        "        displayMath: [ ['$$','$$'] ]," +
        "        processEscapes: true," +
        "        preview: 'TeX'," +
        "    }, " +
        "    'HTML-CSS': { " +
        "        availableFonts: ['STIX', 'TeX']," +
        "        preferredFont: 'STIX'," +
        "        styles: { '.MathJax_Display, .MathJax .mo, .MathJax .mi, .MathJax .mn': {color: 'inherit ! important'} }," +
        "        linebreaks: { automatic: "+ linebreak +", width: '90% container' }," +
        "    }, " +
        "}); " +
        "if ('default' !== 'default') {" +
            "MathJax.Hub.Register.StartupHook('HTML-CSS Jax Ready',function () {" +
                "var VARIANT = MathJax.OutputJax['HTML-CSS'].FONTDATA.VARIANT;" +
                "VARIANT['normal'].fonts.unshift('MathJax_default');" +
                "VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
                "VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
                "VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
            "});" +
            "MathJax.Hub.Register.StartupHook('SVG Jax Ready',function () {" +
                "var VARIANT = MathJax.OutputJax.SVG.FONTDATA.VARIANT;" +
                "VARIANT['normal'].fonts.unshift('MathJax_default');" +
                "VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
                "VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
                "VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
            "});" +
        "}";

    (document.body || document.getElementsByTagName('head')[0]).appendChild(configscript);
    (document.body || document.getElementsByTagName('head')[0]).appendChild(mathjaxscript);
}
</script>
        </div><!-- /.entry-content -->
<a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="janmarjanovic">Tweet</a><script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script><br/><br/>

      </article>
    </div>
</section>
        <section id="extras" >
        
        </section><!-- /#extras -->
	
        <footer id="contentinfo" >
                <address id="about" class="vcard ">
                Proudly powered by <a href="https://getpelican.com/" target="_blank">Pelican</a>, which takes
                great advantage of <a href="https://python.org" target="_blank">Python</a>.
		
                </address><!-- /#about -->
		

                
        </footer><!-- /#contentinfo -->

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-56555055-1', 'auto');
  ga('send', 'pageview');

</script></body>
</html>